import axios from 'axios'
import { isEmptyArray } from '@/utils/utils'
// 跳转页面封装
const axiosInstance = axios.create({
	baseURL: 'http://webapi.ship.zzships.com/api',
	// baseURL:"127.0.0.1:5173",
	timeout: 50000
})
axiosInstance.interceptors.request.use(
	(config) => {
		// console.log("=========request",mockPathList);
		return config
	},
	(error) => {
		return Promise.reject(error)
	}
)
// 进行处理节流
axiosInstance.interceptors.response.use(
	(res) => {
		const { code } = res.data
		if (code == 1) return Promise.resolve(res.data)
		// 放回操作
		// 重定向
		// Do something before response is sent
		return Promise.resolve(res.data)
	},
	(error) => {
		// Do something with response error
		return Promise.reject(error)
	}
)
export default axiosInstance
